<!-- 行业动态页面 -->
<template>
	<view>


		<view class="leadnews_box" v-for="(item,index) in navList" :key="index" @click="gotoDetail(item)">
			<view class="leadnews_box_left">
				<view class="leadnews_box_left_name">
					<u-tag :text="getTypeText(item)" type="warning" show="false" mode="dark" shape="circleRight" />
					<text>{{item.title}}</text>
				</view>
				<view class="leadnews_box_left_time">
					<text>{{item.createTime}}</text>
				</view>
			</view>
			<!--  <view class="leadnews_box_img">
        <u-image width="100%" height="100%" :src="url+item.materialUrl"></u-image>
      </view> -->
		</view>
	</view>
</template>

<script>
	import MySearch from '@/components/my-search/my-search.vue'
	export default {
		components: {
			MySearch
		},
		data() {
			return {
				//是否正在请求数据
				isloading: false,
				url: '',
				params: {
					categoryId: '',
					pageNum: 1,
					pageSize: 10,
				}, //列表数据请求参数
				navList: [],
				total: 0,
				articleType: '', //文章频道类型
			}
		},
		onReady(option) {


		},
		onLoad(option) {



			this.listArticleInfo()
			this.url = this.baseUrl
		},
		methods: {
			// 下拉加载
			onPullDownRefresh() {

			},
			// 触底事件  上拉加载更多
			onReachBottom() {

			},

			// 跳转到 内容详情页
			gotoDetail(item) {
				if (item.type == 1) {
					uni.navigateTo({
						url: '/subpackage/industry_dynamic_detail/industry_dynamic_detail?articleId=' + item
							.id
					})
				} else if (item.type == 2) {
					uni.navigateTo({
						url: '/subpackage/technology_share/shareDetail_fault?shareId=' + item.id
					})
							
				} else if (item.type == 3) {
					uni.navigateTo({
						url: '/subpackage/technology_share/shareDetail?shareId=' + item.id
					})
							
				}
				
			},
			
			getTypeText(item) {
				if (item.type == 1) {
					return "文章";
				} else if (item.type == 2) {
					return "故障消缺";
				} else {
					return "技术分享";
				}
			},
			// 获取内容 列表
			listArticleInfo(cb) {
				this.isloading = true
				this.$u.api.getMyPraises({
						userId: this.$store.state.userinfo.id,
					})
					.then(res => {
						this.navList = res.data;
					});
			},
		}
	}
</script>

<style lang="scss">
	// 搜索组件 吸顶效果
	.search-box {
		// 设置定位效果为“吸顶”
		position: sticky;
		// 吸顶的“位置”
		top: 0;
		// 提高层级，防止被轮播图覆盖
		z-index: 999;
	}

	.uni-thumb {
		image {
			width: 120rpx;
			height: 120rpx;
		}
	}

	.leadnews_box {
		display: flex;
		justify-content: space-between;
		border-bottom: 1px solid #E5E5E5;
		height: 120rpx;
		margin: 20rpx;

		.leadnews_box_left {
			width: 70%;
			height: 90rpx;
			display: flex;
			flex-direction: column;
			justify-content: space-between;

			.leadnews_box_left_name {
				height: 50rpx;
				line-height: 50rpx;
				font-weight: bold;
				font-size: 28rpx;
				color: #1A1A1A;
				text-overflow: -o-ellipsis-lastline;
				letter-spacing: 3rpx;
				overflow: hidden;
				text-overflow: ellipsis;
				display: -webkit-box;
				-webkit-line-clamp: 2;
				line-clamp: 2;
				-webkit-box-orient: vertical;
			}
		}

		.leadnews_box_img {
			width: 30%;
			height: 160rpx;
		}
	}
</style>
